#include<bits/stdc++.h>
using namespace std;
int n,a[100010],r[100010],p[100010],maxn,minn=1e7;
vector<int> v;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        maxn=max(maxn,a[i]);
        minn=min(minn,a[i]);
    }
    if(maxn==2)
    {
        int x=0,y=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]==2)
            {
                x++;
            }
            if(a[i]==1)
            {
                y++;
            }
        }
        cout<<n-min(x,y);
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        r[a[i]]++;
    }
    for(int i=minn;i<=maxn;i++)
    {
        if(r[i]!=0)
        {
            v.push_back(i);
        }
    }
    p[0]=r[v[0]];
    for(int i=1;i<v.size();i++)
    {
        p[i]=p[i-1]+r[v[i]];
    }
    for(int i=1;i<v.size();i++)
    {
        p[i-1]-=min(p[i-1],r[v[i]]);
        p[i]=p[i-1]+r[v[i]];
    }
    cout<<p[v.size()-1];
    return 0;
}
